﻿<UserControl x:Class="Ezpay.UI.Views.CustomerView"
             xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
             xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
             xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" 
             xmlns:d="http://schemas.microsoft.com/expression/blend/2008" 
             xmlns:vs="clr-namespace:Ezpay.UI.Views"
             xmlns:telerik="http://schemas.telerik.com/2008/xaml/presentation"
             xmlns:c="clr-namespace:Ezpay.UI.Controls"
             mc:Ignorable="d" 
             d:DesignHeight="300" d:DesignWidth="300">
    <c:AutoLayoutGrid>
        <Grid.RowDefinitions>
            <RowDefinition Height="Auto"/>
            <RowDefinition Height="Auto"/>
            <RowDefinition Height="Auto"/>
            <RowDefinition Height="Auto"/>
            <RowDefinition Height="Auto"/>
            <RowDefinition Height="Auto"/>
            <RowDefinition Height="Auto"/>
            <RowDefinition Height="Auto"/>
        </Grid.RowDefinitions>
        <DockPanel LastChildFill="False">
            <Button Style="{StaticResource ImageButton}" Command="{Binding EditCommand}" ToolTip="Edit">
                <Image Source="/Resources/Images/pencil_005_16xLG.png" Stretch="None"/>
            </Button>
        </DockPanel>
        <c:AutoLayoutGrid CellPadding="5">
            <Grid.RowDefinitions>
                <RowDefinition Height="Auto"/>
                <RowDefinition Height="Auto"/>
                <RowDefinition Height="Auto"/>
                <RowDefinition Height="Auto"/>
                <RowDefinition Height="Auto"/>
            </Grid.RowDefinitions>
            <Grid.ColumnDefinitions>
                <ColumnDefinition Width="70"/>
                <ColumnDefinition />
            </Grid.ColumnDefinitions>
            <TextBlock Text="Customer ID:"/>
            <TextBlock Text="{Binding CustomerID}"/>
            <TextBlock Text="First Name:"/>
            <TextBlock Text="{Binding FirstName}"/>
            <TextBlock Text="Last Name:"/>
            <TextBlock Text="{Binding LastName}"/>
            <TextBlock Text="Email:"/>
            <TextBlock Text="{Binding PrimaryEmail}"/>
        </c:AutoLayoutGrid>
        <TextBlock Text="Subscriptions" TextDecorations="Underline" Margin="0 5 0 10"/>
        <telerik:RadGridView AutoGenerateColumns="False" ItemsSource="{Binding Subscriptions}">
            <telerik:RadGridView.Columns>
                <telerik:GridViewDataColumn Header="Type" DataMemberBinding="{Binding Type}" Width="100" />

                <telerik:GridViewColumn Header="Description" Width="*" SortMemberPath="Description">
                    <telerik:GridViewColumn.CellTemplate>
                        <DataTemplate>
                            <Button Content="{Binding Description}" Command="{Binding NavigateCommand}" Style="{StaticResource LinkButton}"/>
                        </DataTemplate>
                    </telerik:GridViewColumn.CellTemplate>
                </telerik:GridViewColumn>
            </telerik:RadGridView.Columns>
        </telerik:RadGridView>

        <TextBlock Text="Transactions History" TextDecorations="Underline" Margin="0 5 0 10"/>
        <telerik:RadGridView AutoGenerateColumns="False" ItemsSource="{Binding Transactions}">
            <telerik:RadGridView.Columns>
                <telerik:GridViewDataColumn Header="Date" DataMemberBinding="{Binding DateString}" Width="100" TextAlignment="Center"/>
                <telerik:GridViewColumn Header="Batch #" Width="100" SortMemberPath="BatchNumber">
                    <telerik:GridViewColumn.CellTemplate>
                        <DataTemplate>
                            <Button Content="{Binding BatchNumber}" Style="{StaticResource LinkButton}"/>
                        </DataTemplate>
                    </telerik:GridViewColumn.CellTemplate>
                </telerik:GridViewColumn>
                <telerik:GridViewDataColumn Header="Description" DataMemberBinding="{Binding Description}" Width="*"/>
                <telerik:GridViewDataColumn Header="Credit / Debit" DataMemberBinding="{Binding Credit}" Width="100" TextAlignment="Center"/>
                <telerik:GridViewDataColumn Header="Amount" DataMemberBinding="{Binding Amount}" DataFormatString="C" TextAlignment="Right"  />
            </telerik:RadGridView.Columns>
        </telerik:RadGridView>

        <TextBlock Text="Invoice History" TextDecorations="Underline" Margin="0 5 0 10"/>
        <telerik:RadGridView AutoGenerateColumns="False" ItemsSource="{Binding Invoices}">
            <telerik:RadGridView.Columns>
                <telerik:GridViewDataColumn Header="Date" DataMemberBinding="{Binding DateString}" Width="100" TextAlignment="Center"/>
                <telerik:GridViewColumn Header="Invoice #" SortMemberPath="InvoiceNumber" Width="*">
                    <telerik:GridViewColumn.CellTemplate>
                        <DataTemplate>
                            <Button Content="{Binding InvoiceNumber}" Style="{StaticResource LinkButton}"/>
                        </DataTemplate>
                    </telerik:GridViewColumn.CellTemplate>
                </telerik:GridViewColumn>
                <telerik:GridViewDataColumn Header="Amount" DataMemberBinding="{Binding Amount}" DataFormatString="C" TextAlignment="Right"  />
            </telerik:RadGridView.Columns>
        </telerik:RadGridView>
    </c:AutoLayoutGrid>
</UserControl>
